<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <div>
            <!-- v-if -->
            <!-- 不显示则是不存在 -->
            <div v-if='score>=90'>优秀</div>
            <div v-else-if='score<90&&score>=60'>及格</div>
            <div v-else>差劲</div>
        </div>
        <div>
            <!-- v-show -->
            <!-- 虽然元素不显示但是存在 -->
            <div v-show='flag'>测试v-show</div>
        </div>
        <div>
            <!-- v-for -->
            <ul>
                <!-- 遍历数组 -->
                <li v-for='item in fruits'>{{item}}</li>
                <li v-for='(item,index) in fruits'>{{item+'---'+index}}</li>
                <!-- key的作用方便VUE处理DOM元素时确定兄弟节点不一样，从而提高性能 -->
                <!-- 对实际效果没有任何影响 -->
                <li v-bind:key='index' v-for='(item,index) in fruits'>{{item}}</li>
                <!-- 遍历对象 -->
                <div v-for='(value,key,index) in object'>{{value+'---'+key+'---'+index}}</div>
            </ul>
        </div>
    </div>
    <script src="../js/vue.min.js"></script>
    <script>
        var vm = new Vue({
            el: '#app',
            data: {
                score: 99,
                flag: false,
                fruits: ['apple', 'orange', 'banana'],
                object: {
                    uname: 'list',
                    age: 12,
                    gender: 'male'
                }
            }
        })
    </script>
</body>

</html>